package com.darksider.darkotlin.net.module

import dagger.Module
import dagger.Provides
import okhttp3.Cache
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import javax.inject.Singleton

/**
 * User: yaodong(1126220529@qq.com)
 * Date: 2017-05-26
 * Time: 12:34
 * Description:okhttp依赖模块 并且以来了CacheModule httpLogInterceptorModule
 * Update:
 */
@Module(includes = arrayOf(CacheModule::class, HttpLogInterceptorModule::class))
class OkHttpClientModule {
    @Singleton @Provides fun okhttp(cache: Cache, httpLoginterceptor: HttpLoggingInterceptor): OkHttpClient
            = OkHttpClient.Builder().cache(cache).addInterceptor(httpLoginterceptor).build()
}